<template>
  <view class="inforamtion" style="display: flex;">
  	<view >
  		<view class="option" style="width: 520rpx;">
  			<view class="lf">名称</view>
  			<view class="rl">{{ filterMultiDictText(dictOptions['gsdaId'], item.gsdaId + '') }}</view>
  		</view>
			<view class="option" style="width: 520rpx;" v-if="isFk">
				<view class="lf">是否为付款单位</view>
				<view class="rl">{{ filterMultiDictText(dictOptions['isFk'], item.isFk + '') }}</view>
			</view>
			<view class="option" style="width: 520rpx;" v-else>
				<view class="lf">是否为收款单位</view>
				<view class="rl"> {{ filterMultiDictText(dictOptions['isSk'], item.isSk + '') }}</view>
			</view>
			<!-- <template v-if="isFk && signSealWay == 'online'">
				<view class="option" style="width: 520rpx;">
					<view class="lf">对方是否电子签章</view>
					<view class="rl"> {{ filterMultiDictText(dictOptions['isSignSeal'], item.isSignSeal + '') }}</view>
				</view>
				<view class="option" style="width: 520rpx;" v-if="item.isSignSeal && item.isSignSeal == 1">
					<view class="lf">对方盖章人</view>
					<view class="rl"> {{ item.psnName }}</view>
				</view>
				<view class="option" style="width: 520rpx;" v-if="item.isSignSeal && item.isSignSeal == 1">
					<view class="lf">联系方式</view>
					<view class="rl"> {{ item.psnMobile }}</view>
				</view>
			</template> -->
			<template v-if="signSealWay == 'online'">
				<view class="option" style="width: 520rpx;">
					<view class="lf">我方经办人</view>
					<view class="rl"> {{ item.psnName }}</view>
				</view>
				<view class="option" style="width: 520rpx;">
					<view class="lf">联系方式</view>
					<view class="rl"> {{ item.psnMobile }}</view>
				</view>
			</template>
  	</view>
  	<view  style="flex: 1; display: flex; align-items: center; justify-content: flex-end;" v-if="!disabled">
  		<u-icon name="edit-pen-fill" color="#2979ff" size="20" @click="handleEidtForm(item)"></u-icon>
  		<u-line  direction="col" length="20" margin="0 10rpx"></u-line>
  		<u-icon name="trash-fill" color="#2979ff" size="20" @click="handleRemoveForm(item)"></u-icon>
  	</view>
  </view>
</template>

<script>
import { filterMultiDictText, initDictOptions } from '@/utils/JDictSelectUtil.js'
export default {
  name: 'FormBInfo',
  props: {
    index: {
      type: Number,
      default: null,
    },
		// 用印类型 电子签章 - 实体用印
		signSealWay: {
			type: [String, Number],
			default: '',
			required: false
		},
    item: {
      type: Object,
      default: () => ({}),
    },
		isFk: {
			type: Boolean,
			default: false,
		},
		disabled: {
			type: Boolean,
			default: false,
		}
  },
  data () {
	  return {
		  filterMultiDictText,
		  initDictOptions,
		  dictOptions: {},
	  }
  },
  watch: {
	  item:{
		handler (val) {
			if (val) {
				this.initDictConfig()
			}
		},
		immediate: true,
		deep: true
	  }
  },
  methods: {
	initDictConfig() {
		initDictOptions('erp_company_files,file_name,id').then((res) => {
			if (res.success) {
				this.$set(this.dictOptions, 'gsdaId', res.result)
			}
		})
		initDictOptions('yes_no').then((res) => {
			if (res.success) {
				this.$set(this.dictOptions, 'isFk', res.result)
				this.$set(this.dictOptions, 'isSk', res.result)
				this.$set(this.dictOptions, 'isSignSeal', res.result)
			}
		})
	},
    handleCopyForm(item) {
      this.$emit('copy', [item, this.index])
    },
    handleEidtForm(item) {
      this.$emit('edit', [item, this.index])
    },
    handleRemoveForm(item) {
      uni.showModal({
        content: '确定删除吗？',
        success: (res) => {
          if (res.confirm) {
            this.$emit('remove', item)
          }
        },
      })
    },
  },
}
</script>

<style scoped lang="scss">
	.inforamtion{
		margin-top: 10rpx;
		padding: 10rpx;
		border-radius: 15rpx;
		box-shadow: 0px 4px 20px 0px rgba(0,0,0,0.1);
	}
</style>
